package com.cloudpolice.equipment.service.Impl;

import com.cloudpolice.equipment.dao.EquipmentMapper;
import com.cloudpolice.equipment.model.EquipmentModel;
import com.cloudpolice.equipment.model.EquipmentSiteModel;
import com.cloudpolice.equipment.model.InPutParam.EquipmentSelectInParam;
import com.cloudpolice.equipment.service.EquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：梁昊，后端工程师：flyman5，前端工程师：孙耀
 * @create 2020-02-29 17:16
 * @function
 * @editLog
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class EquipmentServiceImpl implements EquipmentService {
    @Autowired
    EquipmentMapper equipmentMapper;


    /**
     * 新增设备基本信息
     *
     * @param equipmentModel equipment.model.InPutParam.EquipmentModel
     * @return 结果
     */
    @Override
    public int insertEquipment (EquipmentModel equipmentModel) {
        return equipmentMapper.insertEquipment(equipmentModel);
    }

    /**
     * 新增设备基本信息
     *
     * @param equipmentModel equipment.model.InPutParam.EquipmentModel
     * @return 结果
     */
    @Override
    public int insertEquipmentBeforeCheck(EquipmentModel equipmentModel) {
        return equipmentMapper.insertEquipmentBeforeCheck(equipmentModel);
    }

    /**
     * 修改设备基本信息
     *
     * @param equipmentModel equipment.model.InPutParam.EquipmentModel
     * @return 结果
     */
    @Override
    public int updateEquipment (EquipmentModel equipmentModel) {
        return equipmentMapper.updateEquipment(equipmentModel);
    }


    /**
     * 根据id删除基本信息
     *
     * @param id 设备SN号
     * @return 结果
     */
    @Override
    public int DeleteEquipmentById (String id) {
        return equipmentMapper.DeleteEquipmentById(id);
    }

    /**
     * 根据设备SN号得到设备位置信息
     *
     * @param sn 设备sn（外键）
     * @return 设备基本信息
     */
    @Override
    public List<EquipmentSiteModel> SelectEquipmentSiteBySn(String sn) {
        return equipmentMapper.SelectEquipmentSiteBySn(sn);
    }

    /**
     * 根据设备SN号得到设备基本信息
     *
     * @param equipmentSelectInParam 根据设备SN号得到设备基本信息
     * @return 设备基本信息
     */
    @Override
    public EquipmentModel SelectEquipmentBySn(EquipmentSelectInParam equipmentSelectInParam) {
        return equipmentMapper.SelectEquipmentBySn(equipmentSelectInParam);
    }

    /**
     * 通用查询设备基本信息
     *
     * @param equipmentSelectInParam 通用查询设备基本信息
     * @return 结果
     */
    @Override
    public List<EquipmentModel> getEquipmentAll(EquipmentSelectInParam equipmentSelectInParam) {
        return equipmentMapper.getEquipmentAll(equipmentSelectInParam);
    }

}
